package com.swak.consistency.reliablemsg.transport;

import java.util.List;

import com.swak.consistency.reliablemsg.context.ReliableMsgLog;

public class PrimaryReliableMsgLogTransport implements ReliableMsgLogTransport {

	List<ReliableMsgLogTransport> transports;

	public PrimaryReliableMsgLogTransport(List<ReliableMsgLogTransport> transports) {
		this.transports = transports;
	}

	@Override
	public void send(ReliableMsgLog reliableMsg) {
		for (ReliableMsgLogTransport transport : transports) {
			if (transport.support(reliableMsg)) {
				transport.send(reliableMsg);
				return;
			}
		}
	}
}
